package me.zhengjie.modules.transfer.factory.service.Impl;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.account.domain.AccountId40;
import me.zhengjie.modules.account.mapper.AccountCommonMapper;
import me.zhengjie.modules.account.service.AccountAa02Service;
import me.zhengjie.modules.account.service.AccountAc50Service;
import me.zhengjie.modules.account.service.AccountAc51Service;
import me.zhengjie.modules.account.service.AccountId40Service;
import me.zhengjie.modules.sequence.domain.Sequence;
import me.zhengjie.modules.sequence.service.SequenceService;
import me.zhengjie.modules.transfer.domain.TransferIc60;
import me.zhengjie.modules.transfer.domain.TransferIc66;
import me.zhengjie.modules.transfer.factory.service.*;
import me.zhengjie.modules.transfer.factory.vo.*;
import me.zhengjie.modules.transfer.service.TransferIc60Service;
import me.zhengjie.modules.transfer.service.TransferIc66Service;
import me.zhengjie.modules.transfer.service.TransferIc67Service;
import me.zhengjie.modules.transfer.service.TransferIc68Service;
import me.zhengjie.tool.*;
import me.zhengjie.vo.Constant;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 年金转移
 */
@Data
@Service
@RequiredArgsConstructor
public class TransferInformationIc60ServiceImpl implements TransferInformationIc60Service {


    private final TransferInformationService transferInformationService;
    private final TransferPersonService transferPerson;
    private final TransOutDealService transOutDealService;
    private final TransCheckService transCheckService;
    private final AccountCommonMapper accountCommonMapper;
    private final TransferIc60Service transferIc60Service;
    private final SequenceService sequenceService;
    private final AccountAa02Service accountAa02Service;
    private final AccountId40Service accountId40Service;

    private final TransferProcessService transferProcessService;


    /**
     * 人员编号
     */
    protected String aac001;

    /**
     * 转出人员编号
     */
    protected String aac319;

    /**
     * 险种类型
     */
    protected String aae140;

    /**
     * 对方险种
     */
    protected String aae241;

    /**
     * 转移数据来源
     */
    protected String aac306;

    /**
     * 上传方经办人
     */
    protected String aae736;

    /**
     * 上传方经办时间
     */
    protected String aae739;

    /**
     * 联网下载标志
     */
    protected String aae732;
    /**
     * 业务环节
     */
    protected String aae803;

    /**
     * 业务环节状态
     */
    protected String aae158;

    /**
     * 户籍地址
     */
    protected String aac010;

    /**
     * 业务类型编码
     */
    protected String aaa121;
    /**
     * 人员信息
     */
    protected TransferPersonInfo transferPersonInfo;


    /**
     * 转移制度方向
     */
    protected String aic113;

    /**
     * 联系函编号
     */
    protected String aae270;

    /**
     * 银行类别
     */
    protected String aaf200;
    /**
     * 地方银行类别
     */
    protected String aaf216;
    /**
     * 地方银行类别名称
     */
    protected String aaf217;
    /**
     * 对方行政区划
     */
    protected String aab299;

    /**
     * 首次参保地缴费时间
     */
    protected String aab305;

    /**
     * 信息表主键id
     */
    protected String infoKey;

    /**
     * 信息表明细id
     */
    protected String detailsKey;

    /**
     * 信息表其他表id
     */
    protected String othersKey;

    /**
     * 转移基金金额
     */
    protected BigDecimal money;

    /**
     * 被确认标志（指信息表是否已经生成缴费或个人账户信息）
     */
    protected String aae733;

    /**
     * 信息表
     */
    protected InformationInfo informationInfo;

    /**
     * 信息表附表
     */
    protected List<InformationDetailInfo> informationDetailInfos = new ArrayList<>();

    /**
     * 信息表其他附表
     */
    protected List<InformationOtherInfo> informationOtherInfos = new ArrayList<>();

    /**
     * 转入转移基金信息
     */
    protected List<MyMap> funds = new ArrayList<>();

    /**
     * 是否跨省转移
     */
    protected boolean transProvincal;


    /**
     * 是否是信息表特权修改
     */
    protected String transModifyInfo;

    /**
     * 是否是历史补录
     */
    protected String transConanctInfo;

    /**
     * 本地缴费记录
     */
    protected List<Map> paymentList;

    /**
     * 是否是说明
     */
    protected String aae013;

    /**
     * 业务日志号
     */
    protected String aaz002;

    /**
     * 转出保存信息表
     *
     * @param map
     * @return
     */
    @Override
    public Map transOutInfo(MyMap map) {
        this.aac306 = Constant.AAC306_1_BD;

        String aac001 = map.getAsString("aac001");
        NPETool.isEmptyThrowException(aac001, "人员编号");

        NPETool.isEmptyThrowException(map.getAsString("aic113"), "转移制度方向");

        MyMap myMap = transferPerson.xxbAae140Aae241(map.getAsString("aic113"));
         aae140 = myMap.getAsString("aae140");
         aae241 = myMap.getAsString("aae241");
        NPETool.isEmptyThrowException(aae140, "险种类型");
        NPETool.isEmptyThrowException(aae140, "转出险种类型");


        this.aaz002 = map.getAsString("aaz002");

        //1、获取人员基本信息
        MyMap transferPerson1 = transferPerson.getTransferPerson(aac001, aae140);

        //初始化信息表信息
        TransferInformationAnnuity(map);

        map.put("aac306", this.aac306);
        //2、组装人员信息
        transferPersonInfoCreate(transferPerson1, map);

        //3、转出通用校验
        transferInformationService.transferOutCheck(aac001, aae140, aae241, aac306, aic113);
        //4、创建信息表
        transferOut();
        //5、信息表规则校验
        transferInCheck();
        //6、保存信息表
        saveInformation();


        map.put("bae038", "IC60");
        //7、保存流程信息
        transferProcessService.createProcessTransfer(map);

        return transferPerson1;
    }

    /**
     * 转出预览生成信息表
     *
     * @param map
     * @return
     */
    @Override
    public Map informationPreview(MyMap map) {
        this.aac306 = Constant.AAC306_1_BD;
        String aac001 = map.getAsString("aac001");
        NPETool.isEmptyThrowException(aac001, "人员编号");
        NPETool.isEmptyThrowException(map.getAsString("aic113"), "转移制度方向");

        MyMap myMap = transferPerson.xxbAae140Aae241(map.getAsString("aic113"));
         aae140 = myMap.getAsString("aae140");
         aae241 = myMap.getAsString("aae241");
        NPETool.isEmptyThrowException(aae140, "险种类型");
        NPETool.isEmptyThrowException(aae140, "转出险种类型");
        //1、获取人员基本信息
        MyMap transferPerson1 = transferPerson.getTransferPerson(aac001, aae140);

        //初始化信息表信息
        TransferInformationAnnuity(map);

        map.put("aac306", this.aac306);
        //2、组装人员信息
        transferPersonInfoCreate(transferPerson1, map);

        //3、转出通用校验
        transferInformationService.transferOutCheck(aac001, aae140, aae241, aac306, aic113);
        //5、预览生成信息表
        transferOut();
        //6、信息表规则校验
        // transferInCheck();


        Map infromationMap = new HashMap();


        infromationMap.put("information", informationInfo);
        infromationMap.put("informationDetail", informationDetailInfos);
        infromationMap.put("informationOtherInfos", informationOtherInfos);


        System.out.println(JSON.toJSONString(infromationMap));
        return infromationMap;
    }

    /**
     * 转出登记回退
     *
     * @param aaz002
     * @return
     */
    @Override
    public Map transOutRevoke(String aaz002) {
        HashMap map = new HashMap<>();
        map.put("aaz002", aaz002);
        transferIc60Service.removeByMap(map);

        return null;
    }


    public void TransferInformationAnnuity(MyMap myMap) {



        this.aac001 = myMap.getAsString("aac001");
        this.aac319 = myMap.getAsString("aac319");
        this.aae736 = myMap.getAsString("aae736");
        this.aae739 = myMap.getAsString("aae739");
        this.aae732 = myMap.getAsString("aae732");
        this.aac010 = myMap.getAsString("aac010");

        this.aic113 = myMap.getAsString("aic113");
        this.aae270 = myMap.getAsString("aae270");
        this.aac319 = myMap.getAsString("aac319");
        this.aab305 = myMap.getAsString("aab305");

        if (Constant.AAC306_2_YD.equals(this.aac306)) {
            if (!ValidateUtil.isEmpty(myMap.getAsString("fund")) && !"[]".equals(myMap.getAsString("fund"))) {
                List<MyMap> funds_1 = ListUtil.list2MyMapList(JSON.parseArray(myMap.getAsString("fund"), List.class));
                this.funds.addAll(funds_1);
                this.aae733 = Constant.AAE733_1_S;
            } else {
                this.aae733 = Constant.AAE733_0_F;
                if (!ValidateUtil.isEmpty(myMap.get("info"))) {
                    MyMap infoMyMap = MyMap.convertToMap(myMap.getAsString("info"));
                    //如果只转视同，则默认aae733为1，这样才会写入ac08
                    if (!ValidateUtil.isEmpty(infoMyMap.get("aic102"))) {
                        if (BigDecimal.ZERO.compareTo(infoMyMap.getAsBigDecimal("aic102")) == 0) {
                            this.aae733 = Constant.AAE733_1_S;
                        }
                    }
                }
            }
            //外部参数干预 确认标志 （特权维护直接确认）
            if (!ValidateUtil.isEmpty(myMap.getAsString("aae733"))) {
                this.aae733 = myMap.getAsString("aae733");

            }

        } else {
            Map orginfoin = (Map) myMap.get("orginfoin");
            if (!ValidateUtil.isEmpty(orginfoin)) {
                this.aaf216 = (String) orginfoin.get("aaf216");
                this.aaf200 = (String) orginfoin.get("aaf200");
                this.aaf217 = (String) orginfoin.get("aaf217");
                this.aae270 = (String) orginfoin.get("aae270");
                //转出 对方联系函aab301 是转入地行政区划
                this.aab299 = (String) orginfoin.get("aab301");

            }
        }


        if (Constant.AAC306_2_YD.equals(this.aac306)) {
            initInInformation(myMap);
        }

    }


    public void check() {
        transferInformationService.check(new MyMap());

    }

    //转入初始化信息表
    public void initInInformation(MyMap myMap) {


        MyMap info = myMap.convertToMap(myMap.getAsString("info"));
        NPETool.isEmptyThrowException(info, "信息表信息");

        String aab301 = info.getAsString("aab301");
        NPETool.isEmptyThrowException(aab301, "转出地行政区划");

        String aab299 = info.getAsString("aab299");
        NPETool.isEmptyThrowException(aab299, "转入地行政区划");

        if (aab301.substring(0, 2).equals(aab299.substring(0, 2))) {
            this.transProvincal = false;
        } else {
            this.transProvincal = true;
        }

        this.aac319 = info.getAsString("aac319");

        this.informationInfo = new Ic60Info(info);


    }


    public void transferInCheck() {

        Ic60Info ic60Info = (Ic60Info) this.informationInfo;

        this.money = ValidateUtil.isEmpty(ic60Info.getAie074()) ?
                BigDecimal.ZERO : ic60Info.getAie074();

        NPETool.isEmptyThrowException(this.informationInfo, "信息表信息");

        String aae270 = this.informationInfo.getAae270();
        NPETool.isEmptyThrowException(aae270, "联系函编号");
        // 1.校验人员正常参保
        transCheckService.checkAac008(this.getAac001(), this.getAae140());
        // 2.校验转入申请
     //   transCheckService.checkApplication(aae270, this.aae140, this.aae241);
        // 3.校验是否已办理转入
        MyMap myMap = new MyMap();
        myMap.put("aae270", aae270);
        myMap.put("aac001", this.getAac001());
//            List<Map> transferProcess = RepositoryRegister.transferRepository().queryProcessInfo(myMap);
        List<Map> transferProcess = new ArrayList<>();
        if (!ValidateUtil.isEmpty(transferProcess)) {

            for (Map map : transferProcess) {
                if (Constant.AAE803_T0102_ZYJXXXB.equals(map.get("aae803")) || Constant.AAE803_T0502_ZRDFQDLSZHZ.equals(map.get("aae803"))
                        || Constant.AAE803_T0601_JRTYYLBXCBJFPZHXXB.equals(map.get("aae803")) || Constant.AAE803_T0703_CXJMYLBXZRCZZGYLBXXXB.equals(map.get("aae803"))
                        || Constant.AAE803_T0802_CZZGYLBXZRCXJMYLBXXXB.equals(map.get("aae803")) || Constant.AAE803_T0902_CXJBYLBXKDQZYSPB.equals(map.get("aae803"))
                        || Constant.AAE803_T1102_JGYLBXZYXXB.equals(map.get("aae803")) || Constant.AAE803_T1201_JGSYYLBXCZCTRYZYXXB.equals(map.get("aae803"))
                        || Constant.AAE803_T1302_JGSYYLBXZYNJZYXXB.equals(map.get("aae803"))) {
                    throw new IllegalArgumentException("当前联系函已办理了转入");
                }
            }
        }


        if (ValidateUtil.isNotEmpty(this.funds)) {
            BigDecimal aae019 = BigDecimal.ZERO;
            for (MyMap fund : this.funds) {
                aae019 = aae019.add(fund.getAsBigDecimal("aae019"));
            }
            if (!ValidateUtil.isEmpty(aae019)) {
                if (aae019.compareTo(money) != 0) {
                    throw new IllegalArgumentException("财务到账金额和转移金额不一致！");
                }
            }
        }

        BigDecimal aie074 = ValidateUtil.isEmpty(ic60Info.getAie074()) ? BigDecimal.ZERO : ic60Info.getAie074();
        BigDecimal aae240 = ValidateUtil.isEmpty(ic60Info.getAae240()) ? BigDecimal.ZERO : ic60Info.getAae240();
        BigDecimal aae252 = ValidateUtil.isEmpty(ic60Info.getAae252()) ? BigDecimal.ZERO : ic60Info.getAae252();
        BigDecimal aic290 = ValidateUtil.isEmpty(ic60Info.getAic290()) ? BigDecimal.ZERO : ic60Info.getAic290();
        BigDecimal aic005 = ValidateUtil.isEmpty(ic60Info.getAic005()) ? BigDecimal.ZERO : ic60Info.getAic005();
        BigDecimal aae019 = ValidateUtil.isEmpty(ic60Info.getAae019()) ? BigDecimal.ZERO : ic60Info.getAae019();
        if (aie074.compareTo(aae240.add(aae252).add(aic290).add(aic005).add(aae019)) != 0) {
            throw new IllegalArgumentException("职业年金总额应等于记账金额、实账金额、补记的职业年金金额、改革前试点划转金额、企业年金金额之和");
        }

    }


    /**
     * 保存
     */

    public Map saveInformation() {


        Map ic60 = BeanUtil.beanToMap(this.informationInfo);
        TransferIc60 transferIc60 = new TransferIc60();
        Sequence sequence_aaz341 = new Sequence();
        sequence_aaz341.setName("aaz341");
        String aaz341 = sequenceService.nextSequence(sequence_aaz341);
        String aae036 = DateUtil.getCurrentTime("yyyyMMddHHmmss");

        transferIc60.setAaz341(aaz341);
        transferIc60.setAaz159(this.transferPersonInfo.getAaz159().toString());
        transferIc60.setAab301(ValidateUtil.isEmpty(ic60.get("aab301")) ? null : ic60.get("aab301").toString());
        transferIc60.setAab299(ValidateUtil.isEmpty(ic60.get("aab299")) ? null : ic60.get("aab299").toString());
        transferIc60.setAae270(ValidateUtil.isEmpty(ic60.get("aae270")) ? null : ic60.get("aae270").toString());
        transferIc60.setAae405(ValidateUtil.isEmpty(ic60.get("aae405")) ? null : ic60.get("aae405").toString());
        transferIc60.setAae140(this.aae140);
        transferIc60.setAae241(this.aae241);
        transferIc60.setAac001(ValidateUtil.isEmpty(ic60.get("aac001")) ? null : ic60.get("aac001").toString());
        transferIc60.setAac002(ValidateUtil.isEmpty(ic60.get("aac002")) ? null : ic60.get("aac002").toString());
        transferIc60.setAac003(ValidateUtil.isEmpty(ic60.get("aac003")) ? null : ic60.get("aac003").toString());
        transferIc60.setAac004(ValidateUtil.isEmpty(ic60.get("aac004")) ? null : ic60.get("aac004").toString());
        transferIc60.setAac006(ValidateUtil.isEmpty(ic60.get("aac006")) ? null : ic60.get("aac006").toString());
        transferIc60.setAac010(ValidateUtil.isEmpty(ic60.get("aac010")) ? null : ic60.get("aac010").toString());
        transferIc60.setAab300(ValidateUtil.isEmpty(ic60.get("aab300")) ? null : ic60.get("aab300").toString());
        transferIc60.setAie074(ValidateUtil.isEmpty(ic60.get("aie074")) ? null : new BigDecimal(ic60.get("aie074").toString()));
        transferIc60.setAae240(ValidateUtil.isEmpty(ic60.get("aae240")) ? null : new BigDecimal(ic60.get("aae240").toString()));
        transferIc60.setAae252(ValidateUtil.isEmpty(ic60.get("aae252")) ? null : new BigDecimal(ic60.get("aae252").toString()));
        transferIc60.setAic290(ValidateUtil.isEmpty(ic60.get("aic290")) ? null : new BigDecimal(ic60.get("aic290").toString()));
        transferIc60.setAic005(ValidateUtil.isEmpty(ic60.get("aic005")) ? null : new BigDecimal(ic60.get("aic005").toString()));
        transferIc60.setAae019(ValidateUtil.isEmpty(ic60.get("aae019")) ? null : new BigDecimal(ic60.get("aae019").toString()));
        transferIc60.setAae005(ValidateUtil.isEmpty(ic60.get("aae005")) ? null : ic60.get("aae005").toString());
        transferIc60.setAae732(ValidateUtil.isEmpty(ic60.get("aae732")) ? null : ic60.get("aae732").toString());
        transferIc60.setAae733(ValidateUtil.isEmpty(ic60.get("aae733")) ? null : ic60.get("aae733").toString());
        transferIc60.setAae730(ValidateUtil.isEmpty(ic60.get("aae730")) ? null : ic60.get("aae730").toString());
        transferIc60.setAae736(ValidateUtil.isEmpty(ic60.get("aae736")) ? null : ic60.get("aae736").toString());
        transferIc60.setAae739(ValidateUtil.isEmpty(ic60.get("aae739")) ? null : new BigDecimal(ic60.get("aae739").toString()));
        transferIc60.setAae013(ValidateUtil.isEmpty(ic60.get("aae013")) ? null : ic60.get("aae013").toString());
        transferIc60.setAae011(this.transferPersonInfo.getAae011());
        transferIc60.setAae036(new BigDecimal(aae036));
        transferIc60.setAab359(this.transferPersonInfo.getAab359());
        transferIc60.setAac306(this.aac306);
        transferIc60.setAaz002(this.aaz002);

        transferIc60Service.save(transferIc60);

        return null;
    }


    public void transferOut() {
        createInformationOfIc60();
    }

    /**
     * 创建信息表
     */
    private void createInformationOfIc60() {
        //TODOZQ 取年金账户
        MyMap param = new MyMap();
        param.put("aaz159", this.transferPersonInfo.getAaz159());
        param.put("aac001", this.transferPersonInfo.getAac001());
        param.put("aaz198", transferPersonInfo.getAab359());
        QueryWrapper<AccountId40> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("aaz159",this.transferPersonInfo.getAaz159());
        List<Map<String, Object>> id08List = accountId40Service.listMaps(queryWrapper);


        Map id08Map = new HashMap();

            id08Map.put("aie074", id08List.get(0).get("aie074"));//职业年金总额
            id08Map.put("aae240", id08List.get(0).get("aae240"));//记账金额
            id08Map.put("aae252", id08List.get(0).get("aae252"));//实账金额
            id08Map.put("aic290", id08List.get(0).get("aic290"));//补记的职业年金金额
            id08Map.put("aic005", id08List.get(0).get("aic005"));//改革前试点划转金额
            id08Map.put("aae019", id08List.get(0).get("aae019"));//企业年金金额


        Sequence sequence_aae405 = new Sequence();
        sequence_aae405.setName("aae405");
        String aae405 = sequenceService.nextSequence(sequence_aae405);

        Ic60Info ic60Info = new Ic60Info();
        ic60Info.setAab301(transferPersonInfo.getAab359());
        ic60Info.setAab299(this.aab299);
        ic60Info.setAae270(this.aae270);
        ic60Info.setAae405(aae405);
        ic60Info.setAae140(this.aae140);
        ic60Info.setAae241(this.aae241);
        ic60Info.setAac001(this.aac001);
        ic60Info.setAac319(this.aac319);
        ic60Info.setAac003(transferPersonInfo.getAac003());
        ic60Info.setAac004(transferPersonInfo.getAac004());
        ic60Info.setAac002(transferPersonInfo.getAac002());
        ic60Info.setAac006(transferPersonInfo.getAac006().toString());
        ic60Info.setAac010(transferPersonInfo.getAac010());
        ic60Info.setAab300(transferPersonInfo.getAab004());
        ic60Info.setAie074(ValidateUtil.isEmpty(id08Map.get("aie074")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aie074").toString()));
        ic60Info.setAae240(ValidateUtil.isEmpty(id08Map.get("aae240")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aae240").toString()));
        ic60Info.setAae252(ValidateUtil.isEmpty(id08Map.get("aae252")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aae252").toString()));
        ic60Info.setAic290(ValidateUtil.isEmpty(id08Map.get("aic290")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aic290").toString()));
        ic60Info.setAic005(ValidateUtil.isEmpty(id08Map.get("aic005")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aic005").toString()));
        ic60Info.setAae019(ValidateUtil.isEmpty(id08Map.get("aae019")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("aae019").toString()));
        ic60Info.setBae911(ValidateUtil.isEmpty(id08Map.get("bae911")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("bae911").toString()));
        ic60Info.setBae912(ValidateUtil.isEmpty(id08Map.get("bae912")) ? BigDecimal.ZERO : new BigDecimal(id08Map.get("bae912").toString()));
        ic60Info.setAac306(this.aac306);
        this.informationInfo = ic60Info;

    }

    /**
     * 组装人员信息
     *
     * @param transferPerson
     * @param map
     */
    void transferPersonInfoCreate(MyMap transferPerson, MyMap map) {
        transferPersonInfo = new TransferPersonInfo();

        /**
         * 首次参保地缴费时间
         */
        this.aab305 = transferPerson.getAsString("aab305");
        /**
         * 单位编号
         */
        transferPersonInfo.setAab001(transferPerson.getAsBigDecimal("aab001"));
        /**
         * 单位名称
         */
        transferPersonInfo.setAab004(transferPerson.getAsString("aab004"));
        /**
         * 人员编号
         */
        ;
        transferPersonInfo.setAac001(transferPerson.getAsBigDecimal("aac001"));
        /**
         * 社会保障号
         */
        transferPersonInfo.setAac002(transferPerson.getAsString("aac002"));
        /**
         * 姓名
         */
        ;
        transferPersonInfo.setAac003(transferPerson.getAsString("aac003"));
        /**
         * 性别
         */
        transferPersonInfo.setAac004(transferPerson.getAsString("aac004"));
        /**
         * 出生日期
         */
        transferPersonInfo.setAac006(transferPerson.getAsBigDecimal("aac006"));
        /**
         * 参加工作日期
         */
        transferPersonInfo.setAac007(transferPerson.getAsBigDecimal("aac007"));
        /**
         * 户口性质（户籍地类别）
         */
        transferPersonInfo.setAac009(transferPerson.getAsString("aac009"));
        /**
         * 户口所在地址
         */
        transferPersonInfo.setAac010(transferPerson.getAsString("aac010"));
        /**
         * 手机号码
         */
        transferPersonInfo.setAac067(transferPerson.getAsString("aac067"));
        /**
         * 农民工标识
         */
        ;
        transferPersonInfo.setAac028(transferPerson.getAsString("aac028"));
        /**
         * 人员参保关系ID
         */
        transferPersonInfo.setAaz159(transferPerson.getAsBigDecimal("aaz159"));
        /**
         * 个人参保日期
         */
        transferPersonInfo.setAac030(transferPerson.getAsBigDecimal("aac030"));
        /**
         * 参保险种
         */
        transferPersonInfo.setAae140(transferPerson.getAsString("aae140"));
        /**
         * 人员账户类别
         */
        transferPersonInfo.setAae473(transferPerson.getAsString("aae473"));
        /**
         * 统筹区
         */
        transferPersonInfo.setAaa027(transferPerson.getAsString("aaa027"));

        /**
         * 参保机构
         */
        transferPersonInfo.setAab359(map.getAsString("aab359"));
        /**
         * 首次参保年月
         */
        transferPersonInfo.setAac049(transferPerson.getAsBigDecimal("aac049"));

        /**
         * 建立账户年月
         */
        transferPersonInfo.setAae206(transferPerson.getAsBigDecimal("aae206"));

        /**
         * 用工形式
         */
        transferPersonInfo.setAac013(transferPerson.getAsString("aac013"));

        this.aab305 = transferPerson.getAsString("aab305");

        Map orginfoin = (Map) map.get("orginfoin");
        if (!ValidateUtil.isEmpty(orginfoin)) {//转入机构信息从联系函获取
            transferPersonInfo.setAab299(orginfoin.get("aab301").toString());
            transferPersonInfo.setAae270(orginfoin.get("aae270").toString());
        }
        transferPersonInfo.setAae011(map.getAsString("aae011"));

    }


}

